import axios from "/@/utils/http/axios";
import {MethodEnum} from "/@/utils/http/axios/enum/method-enum";
import {
    FlowNodeModel,
    FlowNodeQueryModel,
    FlowQueryModel,
    FlowTaskModel,
    FlowTaskQueryModel
} from "/@/api/flow/model/FlowBaseModel";
import {PageModel} from "/@/api/system/model/CommonModel";
import {DictTypeModel} from "/@/api/system/model/DictModel";

/**
 * 部署流程定义
 * @param isHint
 * @param callBack
 */
export function createFlow(data: FlowQueryModel,callBack?: Function):Promise<string[]> {
    return axios.httpRequest("/flow/base/createFlow", MethodEnum.POST, data, {callBack});
}

/**
 * 根据当前用户分页查询待办任务
 * @param data
 * @param callBack
 */
export function listTodoTaskPageByCurrentUser(data: FlowTaskQueryModel,callBack?: Function):Promise<PageModel<FlowTaskModel[]>> {
    return axios.httpRequest("/flow/base/listTodoTaskPageByCurrentUser", MethodEnum.GET, data, {callBack});
}

/**
 * 根据流程实例回去下一个任务节点
 * @param data
 * @param callBack
 */
export function getNextTaskNode(data: FlowNodeQueryModel,callBack?: Function):Promise<FlowNodeModel[]> {
    return axios.httpRequest("/flow/base/getNextTaskNode", MethodEnum.POST, data, {callBack});
}

/**
 * 获取第一个审批任务节点
 * @param data
 * @param callBack
 */
export function selectFirstFlowNodeInfoByDefinitionKey(definitionKey: string,callBack?: Function):Promise<FlowNodeModel[]> {
    return axios.httpRequest("/flow/base/selectFirstFlowNodeInfoByDefinitionKey", MethodEnum.GET, {definitionKey}, {callBack});
}

